package com.example.demo_yunpan.config;

import org.apache.hadoop.fs.Path;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.apache.hadoop.conf.Configuration;

@org.springframework.context.annotation.Configuration
public class HadoopConfig {

    @Value("${hadoop.config.dir}")
    private String hadoopConfigDir;

    @Bean
    public Configuration hadoopConfiguration() {
        Configuration configuration = new Configuration();
        configuration.addResource(new Path(hadoopConfigDir + "/core-site.xml"));
        configuration.addResource(new Path(hadoopConfigDir + "/hdfs-site.xml"));
        return configuration;
    }
}